using UnityEngine;
using System.Collections;

public class Platform_Broken : MonoBehaviour
{
    private bool runChronometer;
	private float chronometer;
	public float minDistance;
	private float timeToDestroy;
	private const string TAG = "Platform_Broken";
	
	public static string Tag
	{
		get{return TAG;}
	}
	
	void Awake ()
	{
		timeToDestroy = 0.6f;
	}
	
	float distance;

	void FixedUpdate ()
	{
        if (runChronometer)
            chronometer += Time.deltaTime;
		
		if (chronometer >= timeToDestroy)
		{
			//Plataforma fica invisivel e em modo trigger.
			GetComponent<MeshRenderer>().enabled = false;
			GetComponent<BoxCollider>().isTrigger = true;
			
			runChronometer = false;
			chronometer = 0f;
		}
	}
	
	public void RecieveMessage()
	{
		runChronometer = true;
	}
	
	public bool RunChronometer { set{ runChronometer = value; } }
	
	public float Chronometer{ set { chronometer = value; } }
}